<template>
  <div>
    <p style="margintop: 16">Clicked count: {{ throttleFnValue }}</p>
    <button type="button" @click="run">useThrottleFn测试</button>
  </div>
  <div>
    <input
      v-model="throttleCurrValue"
      placeholder="Typed value"
      style="width: 280"
    />
    <p style="margintop: 16">throttleValue: {{ throttleValue }}</p>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { useThrottleFn } from '@/hooks/useThrottleFn'
import { useThrottle } from '@/hooks/useThrottle'

const throttleFnValue = ref(1)
const { run } = useThrottleFn(() => {
  throttleFnValue.value++
}, 2000)

const throttleCurrValue = ref(1)
const throttleValue = useThrottle(throttleCurrValue, 2000)
</script>
